package com.potenza.training.resume.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.potenza.training.resume.dao.AdvantageDao;
import com.potenza.training.resume.entity.AdvantageEntity;
import com.potenza.training.resume.service.AdvantageService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("advantageService")
public class AdvantageServiceImpl extends ServiceImpl<AdvantageDao, AdvantageEntity> implements AdvantageService {

    @Autowired
    AdvantageDao advantageDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<AdvantageEntity> page = this.page(
                new Query<AdvantageEntity>().getPage(params),
                new QueryWrapper<AdvantageEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public AdvantageEntity infoid(Integer resumeid) {
        QueryWrapper<AdvantageEntity> advantageEntityQueryWrapper = new QueryWrapper<>();
        advantageEntityQueryWrapper.lambda().eq(AdvantageEntity::getResumeId,resumeid);

        return advantageDao.selectOne(advantageEntityQueryWrapper);
    }

}